package club.banyuan.demo.demo1;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author edz
 * @version 1.0
 * @date 2020/11/25 下午8:35
 */
public class demo1 {
    public static void main(String[] args) throws ParseException {
        String st1="19950129";
        SimpleDateFormat sim1= new SimpleDateFormat("yyyyMMdd");
        long time1 = sim1.parse(st1).getTime();
        System.out.println(time1);


        String st2="20201126";
        SimpleDateFormat sim2= new SimpleDateFormat("yyyyMMdd");
        long time2 = sim2.parse(st2).getTime();
        System.out.println(time2);

        long time=time2-time1;
        System.out.println(time);

        Date date = new Date();
        date.setTime(time);
        System.out.println(new SimpleDateFormat().format(date));


    }

}